// SPDX-License-Identifier: MIT
// Copyright (C) 2018-present iced project and contributors

#if INSTR_INFO
using System;
using System.Collections.Generic;
using Iced.Intel;

namespace Iced.UnitTests.Intel {
	static partial class ToEnumConverter {
		public static bool TryConditionCode(string value, out ConditionCode conditionCode) => conditionCodeDict.TryGetValue(value, out conditionCode);
		public static ConditionCode GetConditionCode(string value) => TryConditionCode(value, out var conditionCode) ? conditionCode : throw new InvalidOperationException($"Invalid ConditionCode value: {value}");

		static readonly Dictionary<string, ConditionCode> conditionCodeDict =
			// GENERATOR-BEGIN: ConditionCodeHash
			// ⚠️This was generated by GENERATOR!🦹‍♂️
			new Dictionary<string, ConditionCode>(17, StringComparer.Ordinal) {
				{ "None", ConditionCode.None },
				{ "o", ConditionCode.o },
				{ "no", ConditionCode.no },
				{ "b", ConditionCode.b },
				{ "ae", ConditionCode.ae },
				{ "e", ConditionCode.e },
				{ "ne", ConditionCode.ne },
				{ "be", ConditionCode.be },
				{ "a", ConditionCode.a },
				{ "s", ConditionCode.s },
				{ "ns", ConditionCode.ns },
				{ "p", ConditionCode.p },
				{ "np", ConditionCode.np },
				{ "l", ConditionCode.l },
				{ "ge", ConditionCode.ge },
				{ "le", ConditionCode.le },
				{ "g", ConditionCode.g },
			};
			// GENERATOR-END: ConditionCodeHash
	}
}
#endif
